import React, { Component } from 'react'
import { Route, Redirect, Switch } from 'react-router-dom'
import css from './App.module.css'
import Header from './components/Header' //一般组件
import MyNavLink from './components/MyNavLink' //一般组件
import About from './pages/About' //路由组件
import Home from './pages/Home'
export default class App extends Component {
    render() {
        return (
            <div className={css.page}>
                <div className={css.header}>
                    <Header />
                </div>
                <div className={css.bottom}>
                    <div className={css.navigate}>
                        <MyNavLink to="/home" >home</MyNavLink>
                        <MyNavLink to="/about">about</MyNavLink>
                    </div>
                    {/* 注册路由 */}
                    <div className={css.contents}>
                        <Switch>
                            <Route path="/about" component={About}></Route>
                            <Route path="/home" component={Home}></Route>
                            <Redirect to='/home' />
                        </Switch>
                    </div>
                </div>
            </div>
        )
    }
}
